<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('parent_id',false,true)->default(0)->comment('父级分类');
            $table->string('title',100)->default('')->comment('名字');
            $table->string('url',100)->default('')->comment('url');
            $table->tinyInteger('status')->default(1)->comment('状态，-1删除，0禁用,1正常');
            $table->integer('sort_no',false,true)->default(9)->comment('排序，越小排名越前');
            $table->tinyInteger('is_menu')->default(1)->comment('是否是菜单,0否,1是');
            $table->tinyInteger('is_checked')->default(1)->comment('是否进行权限检查，0否,1是');
            $table->tinyInteger('method')->default(0)->comment('请求方式,0any,1get,2post');
            $table->timestamps();
            $table->index('parent_id');
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `menus` comment '后台权限表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menus');
    }
}
